<style type="text/css">
.isforlong .col-sm-10 {
	margin-top: 10px;
}
</style>
<div class="pageheader">
	<h2>
		<i class="fa fa-inbox"></i>库存管理
	</h2>
	<div class="breadcrumb-wrapper">
		<span class="label">你所在的位置：</span>
		<ol class="breadcrumb">
			<li><a href="/index">ERP管理系统</a></li>
			<li>库存管理</li>
			<li>库存列表</li>
			<li class="active">库存修改</li>
		</ol>
	</div>
</div>
<div class="contentpanel">
<div class="main">
<form action="/stock/update?id=<?php echo $this->stocklist['stock_id'];?>" method="post" class="form-horizontal">
    <?php if ($this->msg):?>
    <div style="margin: 20px 216px;" class="form-group"><?php foreach ($this->msg as $v):?><span class="label label-warning"><?php echo $v;?></span><?php endforeach;?></div>
    <?php endif;?> 
    <div class="form-group form-inline">
        <label for="productname" class="col-sm-2 control-label">产品名称：</label>
        <div class="col-sm-10">
            <input type="hidden" class="form-control" name="stockid" value="<?php echo $this->stocklist['stock_id'];?>" size="58">
            <input type="text" class="form-control" name="productname" value="<?php echo $this->stocklist['title'];?>" size="58">
        </div>
    </div>
    <div class="form-group form-inline">
        <label for="productenname" class="col-sm-2 control-label">英文标题：</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="productenname" value="<?php echo $this->stocklist['en_title'];?>" size="58">
        </div>
    </div>
    <div class="form-group form-inline">
        <label for="Sku" class="col-sm-2 control-label">Sku：</label>
        <div class="col-sm-10">
            <input type="text" readonly="readonly" class="form-control" name="sku" value="<?php echo $this->stocklist['sku'];?>" size="58"></input>
        </div>
    </div>
    <div class="form-group">
        <label for="Category" class="col-sm-2 control-label">分类：</label>
        &nbsp;&nbsp;&nbsp;&nbsp;brand:
        <div class="btn-group">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">请选择 <span class="caret"></span></button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="#">brand1</a></li>
                <li><a href="#">brand2</a></li>
                <li><a href="#">brand3</a></li>
           </ul>
        </div>
        &nbsp;&nbsp;&nbsp;&nbsp;player:
        <div class="btn-group">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">请选择 <span class="caret"></span></button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="#">player1</a></li>
                <li><a href="#">player2</a></li>
                <li><a href="#">player3</a></li>
           </ul>
        </div>
    </div>
    <div class="form-group">
        <label for="content" class="col-sm-2 control-label">产品内容：</label>
        <div style="margin-bottom: 10px;margin-left: 200px;">
            <input style="width: 100px;" type="button" class="form-control" value="添加规格" onclick="addPatternSize(this);"></input>
		</div>
		<div style="margin-bottom: 10px;margin-left: 200px;">
		    <label class="label label-warning">修改尺码时请确保缺货导出列表和未处理的订单列表无该SKU的商品，否则可能导致缺货导出所打印的条形码失效或对应的订单处理不了。</label>
		</div>
		<?php foreach($this->stockvaluelist as $v):?>
		<div style="margin-bottom: 10px;margin-left: 200px;">
		        规格大小：
		    <input style="width: 100px;display: inline;" type="text" class="form-control" name="pattern_size[]" value="<?php echo $v['size'];?>" size="15" />
			实际库存：
			<input style="width: 100px;display: inline;" type="text" class="form-control" name="pattern_size_stock[]" value="<?php echo $v['t_value'];?>" size="10" />
			警告阀值：
			<input style="width: 100px;display: inline;" type="text" class="form-control" name="warning_value[]" size="10" value="<?php echo $v['warning_value'];?>" />
			<input style="width: 100px;display: inline;" type="button" class="form-control" onclick="deletePatternSize(this);" value="删除">
		</div>
		<?php endforeach;?>   
    </div>
    <div class="form-group isforlong">
        <label for="isforlong" class="col-sm-2 control-label">是否永不下架：</label>
        <div class="col-sm-10">
                        是：<input type="radio" name="is_forlong" value="1" <?php if($this->stocklist['is_forlong']==1):?> checked="checked" <?php endif;?>></input> 
			否：<input type="radio" name="is_forlong" value="0" <?php if($this->stocklist['is_forlong']==0):?> checked="checked" <?php endif;?>></input>									
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default">提交</button>
        </div>
    </div>
</form>
</div>
</div>
<script>
function deletePatternSize(thisInput){
	$(thisInput).parent().remove();
}
function addPatternSize(thisInput){
	$(thisInput).parent().parent().append('<div style="margin-bottom: 10px;margin-left: 200px;">规格大小：&nbsp;<input style="width: 100px;display: inline;" type="text" class="form-control" name="pattern_size[]" value="" size="15"/>&nbsp;实际库存：&nbsp;<input style="width: 100px;display: inline;" type="text" class="form-control" name="pattern_size_stock[]" value="0" size="10"/>&nbsp;警告阀值：&nbsp;<input style="width: 100px;display: inline;" class="form-control" type="text" name="warning_value[]" size="10" />&nbsp;<input style="width: 100px;display: inline;" class="form-control" type="button" onclick="deletePatternSize(this);" value="删除"></div>');
	//commonEffection.resetFrame('admins_frame',true);
}
</script>